package com.ruoyi.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqConfig {


    @Bean
    public TopicExchange couponExchange() {
        return new TopicExchange("CouponExchange", true, false);
    }

    @Bean
    public Queue couponQueue() {
        return new Queue("CouponQueue", true);
    }

    @Bean
    public Binding binding(Queue couponQueue, TopicExchange couponExchange) {
        return BindingBuilder.bind(couponQueue).to(couponExchange).with("coupon.#");
    }

}
